<?php


namespace app\admin\controller\virtual;


use think\Request;
use app\admin\model\ClassQu as ClassQuModel;

class ClassQu
{
    public function list(Request $request)
    {
        $res = ClassQuModel::list();
        return successJson("success",$res);
    }

    public function add(Request $request)
    {
        $title = $request->param("title");
        $u = $request->_user;
        $p = ClassQuModel::add($title, $u["staff_no"]);
        if($p) return failedJson($p);
        return successJson("success");
    }

    public function up(Request $request)
    {
        $id = $request->param("id");
        $title = $request->param("title");
        $u = $request->_user;
        $p = ClassQuModel::up($title, $id,$u["staff_no"]);
        if($p) return failedJson($p);
        return successJson("success");
    }

    public function del(Request $request)
    {
        $id = $request->param("id");
        $p = ClassQuModel::del($id);
        if($p) return failedJson($p);
        return successJson("success");
    }

}